/* pfs12Animation.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/pfs12Animation.h>
#include <wrapper/JavaStreamWrapper.h>

pfs12Animation::pfs12Animation()
    : McPacketFromServer(0x12), entityId(0), animationId(0)
{
}

unsigned int pfs12Animation::length()
{
    return 1 + 4 + 1;
}

int16_t pfs12Animation::setField(uint8_t field, void* value)
{

    switch (field)
    {
        case 0:
        default: return 4;
        case 1: entityId = JavaStreamWrapper::readInt(value); return 1;
        case 2: animationId = JavaStreamWrapper::readByte(value); return -1;
    }
}

int32_t pfs12Animation::getEntityId()
{
    return entityId;
}

int8_t pfs12Animation::getAnimationId()
{
    return animationId;
}


